-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import pre setup command base code #1542
import pre setup command base code #1542
Conversation
…mport-setup-command
…li into feat/import-setup-command
@@ -0,0 +1 @@ | |||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shafeeqd959 what purpose we used this empty object file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add messages in future commits
"dependencies": { | ||
"@contentstack/cli-command": "~1.3.0", | ||
"@contentstack/cli-utilities": "~1.7.1", | ||
"@contentstack/management": "~1.17.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shafeeqd959 , Since we're using cli-utilities, so management sdk isn't required here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove in the upcoming commits
export const formatError = (error: any) => { | ||
try { | ||
if (typeof error === 'string') { | ||
error = JSON.parse(error); | ||
} else { | ||
error = JSON.parse(error.message); | ||
} | ||
} catch (e) {} | ||
let message = error?.errorMessage || error?.error_message || error?.message || error; | ||
if (error && error.errors && Object.keys(error.errors).length > 0) { | ||
Object.keys(error.errors).forEach((e) => { | ||
let entity = e; | ||
if (e === 'authorization') entity = 'Management Token'; | ||
if (e === 'api_key') entity = 'Stack API key'; | ||
if (e === 'uid') entity = 'Content Type'; | ||
if (e === 'access_token') entity = 'Delivery Token'; | ||
message += ' ' + [entity, error.errors[e]].join(' '); | ||
}); | ||
} | ||
return message; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shafeeqd959 , We can utilise formatError, which we created in utilities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will use it in the upcoming commits
import pre setup command base code
import pre setup command base code
No description provided.